﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace KWT.DRG_DIP.API.Migrations
{
    /// <inheritdoc />
    public partial class _20250405152516 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterDatabase()
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ChargeInfo_Item",
                columns: table => new
                {
                    CIID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ListID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "清单ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ItemName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "项目名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Amount = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "金额"),
                    Jia = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "甲类"),
                    Yi = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "乙类"),
                    Self = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "自费"),
                    Others = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "其他")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ChargeInfo_Item", x => x.CIID);
                },
                comment: "医疗收费信息明细")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "DiagInfo_Item",
                columns: table => new
                {
                    DIID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ListID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "清单ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Type = table.Column<int>(type: "int", nullable: false, comment: "1：主要 0：其他"),
                    Way = table.Column<int>(type: "int", nullable: false, comment: "1：西医 2：中医"),
                    Code = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "病种代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Desc = table.Column<string>(type: "varchar(4000)", maxLength: 4000, nullable: false, comment: "入院病情")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DiagInfo_Item", x => x.DIID);
                },
                comment: "住院诊疗信息（中西医诊断列表）")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "DiagInfo_OperItem",
                columns: table => new
                {
                    DOID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ListID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "清单ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Type = table.Column<int>(type: "int", nullable: false, comment: "1：主要 0：其他"),
                    OperName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "手术及操作名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "手术及操作代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Way = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "麻醉方式")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperDocName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "医师姓名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperDocCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "医师代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AnesDocName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "麻醉医师姓名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AnesDocCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "麻醉医师代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "手术起始时间"),
                    AnesTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "麻醉起始时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DiagInfo_OperItem", x => x.DOID);
                },
                comment: "住院诊疗信息（手术信息）")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "List_BasicInfo",
                columns: table => new
                {
                    ListID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "清单ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RealName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "姓名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PinYin = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "姓名拼音首字母")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sex = table.Column<int>(type: "int", nullable: false, comment: "性别"),
                    Year = table.Column<int>(type: "int", nullable: false, comment: "出生年"),
                    Month = table.Column<int>(type: "int", nullable: false, comment: "出生月"),
                    Day = table.Column<int>(type: "int", nullable: false, comment: "出生日"),
                    Age = table.Column<int>(type: "int", nullable: false, comment: "年龄"),
                    Age_New = table.Column<int>(type: "int", nullable: false, comment: "（年龄不足1周岁） 年龄"),
                    Coutry = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "国家")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Nation = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "民族")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CertType = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "患者证件类别")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CertNo = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "患者证件号码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    JobType = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "职业")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    HomeAddress = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "现住址")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    JobName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "工作单位名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    JobAddress = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "工作单位地址")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    JobPhone = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "单位电话")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    JobPostCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "单位邮政编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ContactName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "联系人姓名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ContactType = table.Column<int>(type: "int", nullable: false, comment: "与联系人的关系"),
                    ContactAddress = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "联系人地址")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ContactPhone = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "联系人电话")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    InsureType = table.Column<int>(type: "int", nullable: false, comment: "医保类型"),
                    SpecialType = table.Column<int>(type: "int", nullable: false, comment: "特殊人员类型"),
                    JoinArea = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "参保地名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    JoinCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "参保地编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    NewBornInType = table.Column<int>(type: "int", nullable: false, comment: "新生儿入院类型"),
                    NewBornOutWeight = table.Column<int>(type: "int", nullable: false, comment: "新生儿出院体重"),
                    NewBornInWeight = table.Column<int>(type: "int", nullable: false, comment: "新生儿入院体重")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_List_BasicInfo", x => x.ListID);
                },
                comment: "医保结算清单（基本信息）")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "List_ChargeInfo",
                columns: table => new
                {
                    ListID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "清单流水号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ChargeID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "业务流水号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TicketCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "票据代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TicketNo = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "票据号码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    StartDate = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "结算开始时间"),
                    EndDate = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "结算结束时间"),
                    YBTCJJZF = table.Column<decimal>(type: "decimal(18,10)", precision: 10, scale: 2, nullable: false, comment: "医保统筹基金支付"),
                    ZGDEBZ = table.Column<decimal>(type: "decimal(18,10)", precision: 10, scale: 2, nullable: false, comment: "职工大额补助"),
                    JMDBBX = table.Column<decimal>(type: "decimal(18,10)", precision: 10, scale: 2, nullable: false, comment: "居民大病保险"),
                    GWYYLBZ = table.Column<decimal>(type: "decimal(18,10)", precision: 10, scale: 2, nullable: false, comment: "公务员医疗补助"),
                    GRZF1 = table.Column<decimal>(type: "decimal(18,10)", precision: 10, scale: 2, nullable: false, comment: "个人自付"),
                    GRZF2 = table.Column<decimal>(type: "decimal(18,10)", precision: 10, scale: 2, nullable: false, comment: "个人自费"),
                    YLJZZF = table.Column<decimal>(type: "decimal(18,10)", precision: 10, scale: 2, nullable: false, comment: "医疗救助支付"),
                    QYBC = table.Column<decimal>(type: "decimal(18,10)", precision: 10, scale: 2, nullable: false, comment: "企业补充"),
                    SYBX = table.Column<decimal>(type: "decimal(18,10)", precision: 10, scale: 2, nullable: false, comment: "商业保险"),
                    GRZHZF = table.Column<decimal>(type: "decimal(18,10)", precision: 10, scale: 2, nullable: false, comment: "个人账户支付"),
                    GRXJZF = table.Column<decimal>(type: "decimal(18,10)", precision: 10, scale: 2, nullable: false, comment: "个人现金支付"),
                    PayType = table.Column<int>(type: "int", nullable: false, comment: "医保支付方式"),
                    Section = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "定点医疗机构填报部门")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Dept = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "医保经办机构")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FillPerson = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "定点医疗机构填报人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DoPerson = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "医保机构经办人")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_List_ChargeInfo", x => x.ListID);
                },
                comment: "医疗收费信息")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "List_CheckItem",
                columns: table => new
                {
                    LCID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ListID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "清单ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Type = table.Column<int>(type: "int", nullable: false, comment: "-1:驳回，1：通过 "),
                    UserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Memo = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "原因")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ActionTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "操作时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_List_CheckItem", x => x.LCID);
                },
                comment: "清单操作明细")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "List_DiagInfo",
                columns: table => new
                {
                    DIID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ListID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "清单流水号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MedicalType = table.Column<int>(type: "int", nullable: false, comment: "住院医疗类型"),
                    Way = table.Column<int>(type: "int", nullable: false, comment: "入院途径"),
                    HealType = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "治疗类型")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    InTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "入院时间"),
                    InDept = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "入院科别")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TurnDept = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "转科科别")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OutTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "出院时间"),
                    OutDept = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "出院科别")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    InDays = table.Column<int>(type: "int", nullable: false, comment: "实际住院（天）"),
                    In_WM_Diag = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "门诊诊断（西医）")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    In_WM_Code = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "疾病代码（西医）")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    In_TCM_Diag = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "门诊诊断（中医）")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    In_TCM_Code = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "疾病代码（中医）")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UseDay = table.Column<int>(type: "int", nullable: false, comment: "呼吸机使用天数"),
                    UseHour = table.Column<int>(type: "int", nullable: false, comment: "呼吸机使用小时数"),
                    UseMinute = table.Column<int>(type: "int", nullable: false, comment: "呼吸机使用分钟数"),
                    StunDay1 = table.Column<int>(type: "int", nullable: false, comment: "昏迷天数1"),
                    StunHour1 = table.Column<int>(type: "int", nullable: false, comment: "昏迷小时数1"),
                    StunMinute1 = table.Column<int>(type: "int", nullable: false, comment: "昏迷分钟数1"),
                    StunDay2 = table.Column<int>(type: "int", nullable: false, comment: "昏迷天数2"),
                    StunHour2 = table.Column<int>(type: "int", nullable: false, comment: "昏迷小时数2"),
                    StunMinute2 = table.Column<int>(type: "int", nullable: false, comment: "昏迷分钟数2"),
                    Care0 = table.Column<int>(type: "int", nullable: false, comment: "特级护理天数"),
                    Care1 = table.Column<int>(type: "int", nullable: false, comment: "一级护理天数"),
                    Care2 = table.Column<int>(type: "int", nullable: false, comment: "二级护理天数"),
                    Care3 = table.Column<int>(type: "int", nullable: false, comment: "三级护理天数"),
                    OutWay = table.Column<int>(type: "int", nullable: false, comment: "离院方式"),
                    OutWay_Dept = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "离院方式(机构名称)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OutAgainType = table.Column<int>(type: "int", nullable: false, comment: "是否有出院31天内再住院计划"),
                    OutAgainType_Memo = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "是否有出院31天内再住院计划（目的）")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DcName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "主诊医师姓名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DcCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "主诊医师代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    NurseName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "责任护士姓名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    NurseCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "责任护士代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ICU_Json = table.Column<string>(type: "varchar(4000)", maxLength: 4000, nullable: false, comment: "重症监护信息列表")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Blood_Json = table.Column<string>(type: "varchar(4000)", maxLength: 4000, nullable: false, comment: "输血信息列表")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_List_DiagInfo", x => x.DIID);
                },
                comment: "医保结算清单（住院诊疗信息）")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "List_SepcialDiagInfo",
                columns: table => new
                {
                    SDID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ListID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "清单流水号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DiagType = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "诊断科别")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DiagTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "就诊日期"),
                    DiseaseName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "病种名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DiseaseCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "病种代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "手术及操作名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "手术及操作代码")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_List_SepcialDiagInfo", x => x.SDID);
                },
                comment: "医保结算清单（慢特病诊疗信息）")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Menu_Func",
                columns: table => new
                {
                    MFID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MenuID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FuncID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Menu_Func", x => x.MFID);
                },
                comment: "")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Module_Tanent",
                columns: table => new
                {
                    MTID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ModuleID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TanentID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Module_Tanent", x => x.MTID);
                },
                comment: "")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Role_Func",
                columns: table => new
                {
                    RFID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RoleID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FuncID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Columns = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Role_Func", x => x.RFID);
                },
                comment: "角色功能 关系表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Role_Menu",
                columns: table => new
                {
                    RMID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RoleID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MenuID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Role_Menu", x => x.RMID);
                },
                comment: "角色-菜单 关系表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_Category",
                columns: table => new
                {
                    CategoryID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Icon = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ParentID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_Category", x => x.CategoryID);
                },
                comment: "")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_Dept",
                columns: table => new
                {
                    DeptID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "科室主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AreaID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "院区")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "父键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "院内科室名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Code = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "院内科室代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Code1 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "国标一级代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name1 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "国标一级名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Code2 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "国标二级代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name2 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "国标二级名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_Dept", x => x.DeptID);
                },
                comment: "科室")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_Enum",
                columns: table => new
                {
                    EnumID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Group = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "组")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Value = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "值")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Text = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "文本")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Desc = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "说明")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_Enum", x => x.EnumID);
                },
                comment: "枚举字典")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_Func",
                columns: table => new
                {
                    FuncID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Url = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_Func", x => x.FuncID);
                },
                comment: "系统功能")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_List",
                columns: table => new
                {
                    ListID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AreaID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "所属院区")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    QDLSH = table.Column<long>(type: "bigint", nullable: false, comment: "清单流水号"),
                    HospitalName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "定点医疗机构名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    HospitalCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "定点医疗机构代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Level = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "医保结算等级")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    InsureCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "医保编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Number = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "病案号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeclareTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "申报时间"),
                    DeptID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "科室ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeptName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "科室名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DRG_Code = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "DRG编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DRG_Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "DRG名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Diag_Code = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "主要诊断编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Diag_Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "主要诊断名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Oper_Code = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "主要手术操作编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Oper_Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "主要手术操作名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Mag = table.Column<decimal>(type: "decimal(18,1)", precision: 1, nullable: false, comment: "倍率"),
                    MagType = table.Column<int>(type: "int", nullable: false, comment: "倍率类型"),
                    Point = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "点数"),
                    Score = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "分数"),
                    MagName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "倍率名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SettleType = table.Column<int>(type: "int", nullable: false, comment: "结算方式"),
                    TotalFee = table.Column<decimal>(type: "decimal(18,2)", precision: 2, nullable: false, comment: "医疗总费用"),
                    InDays = table.Column<int>(type: "int", nullable: false, comment: "住院天数"),
                    OutDate = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "出院日期"),
                    SettleDate = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "结算日期"),
                    Doctor = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "主治医生")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Coder = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "编码员")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Abnormal = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "异常行为")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CheckStatus = table.Column<int>(type: "int", nullable: false, comment: "审核状态"),
                    UploadStatus = table.Column<int>(type: "int", nullable: false, comment: "上传状态"),
                    UploadEndTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "上传截止日期"),
                    Flag = table.Column<int>(type: "int", nullable: false, comment: "清单质控"),
                    FeeRemain = table.Column<decimal>(type: "decimal(18,2)", precision: 2, nullable: false, comment: "费用结余")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_List", x => x.ListID);
                },
                comment: "医保结算清单")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_Menu",
                columns: table => new
                {
                    MenuID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ModuleID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "所属模块")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "父级ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Title = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "菜单名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Icon = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "图标")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Path = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "路由")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "路由名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Component = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "组件")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_Menu", x => x.MenuID);
                },
                comment: "菜单")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_Module",
                columns: table => new
                {
                    ModuleID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_Module", x => x.ModuleID);
                },
                comment: "系统模块")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_Para",
                columns: table => new
                {
                    ParaID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DRG_Code = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "DRG代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DRG_Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "DRG名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    QZ = table.Column<decimal>(type: "decimal(18,6)", precision: 6, nullable: false, comment: "权重"),
                    ZGFFBZ = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "职工付费标准"),
                    JMFFBZ = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "居民付费标准"),
                    LJFY = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "例均费用"),
                    ZYTSBGZ = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "住院天数标杆值(天)"),
                    HighMag = table.Column<decimal>(type: "decimal(18,1)", precision: 1, nullable: false, comment: "高倍率"),
                    LowMag = table.Column<decimal>(type: "decimal(18,1)", precision: 1, nullable: false, comment: "低倍率"),
                    IsSpecial = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否特病单议病组"),
                    SpecialFlag = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "特殊标签")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_Para", x => x.ParaID);
                },
                comment: "")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_PolicyEnum",
                columns: table => new
                {
                    SPID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Group = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "组")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Code1 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "代码1")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Code2 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "代码2")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Code3 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "代码3")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name1 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "名称1")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name2 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "名称2")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name3 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "名称3")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PinYin1 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "名称1的拼音首字母")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PinYin2 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "名称2的拼音首字母")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PinYin3 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "名称3的拼音首字母")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    GrpCondition1 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "分组条件")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    GrpCondition2 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "组合分组条件")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_PolicyEnum", x => x.SPID);
                },
                comment: "策略字典表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_Record",
                columns: table => new
                {
                    RecordID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "用户主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    KeyID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "卡密主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Type = table.Column<int>(type: "int", nullable: false, comment: "1.下载记录\n2.购买记录\n3.赠送记录"),
                    Amount = table.Column<int>(type: "int", nullable: false, comment: "数量"),
                    Money = table.Column<decimal>(type: "decimal(9,2)", nullable: false, comment: "单价"),
                    RecordTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "记录时间"),
                    Desc = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AccountID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_Record", x => x.RecordID);
                },
                comment: "记录表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_RefreshToken",
                columns: table => new
                {
                    TokenID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "用户ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Token = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "token值")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Access_Token = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "acess_token")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Is_Used = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否已使用"),
                    Is_Revorked = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否已回收"),
                    Add_Date = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "添加时间"),
                    Exp_Date = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "过期时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_RefreshToken", x => x.TokenID);
                },
                comment: "系统RefreshToken")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_Role",
                columns: table => new
                {
                    RoleID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "角色名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_Role", x => x.RoleID);
                },
                comment: "系统角色")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_SecretKey",
                columns: table => new
                {
                    KeyID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "用户主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Batch = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "批次")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Value = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "值")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "状态\n0.未使用\n1.已使用\n-1.已过期\n-2.已作废\n-99.已禁用"),
                    ExpireTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "过期时间"),
                    Quota = table.Column<int>(type: "int", nullable: false, comment: "配额"),
                    Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "卡密名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Type = table.Column<int>(type: "int", nullable: false, comment: "-1.年\n0.月\n1.日\n2.小时\n3.分钟"),
                    Category = table.Column<int>(type: "int", nullable: false, comment: "0.\n1.\n2."),
                    Number = table.Column<int>(type: "int", nullable: false, comment: ""),
                    AIQuota = table.Column<int>(type: "int", nullable: false, comment: ""),
                    AIType = table.Column<int>(type: "int", nullable: false, comment: ""),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_SecretKey", x => x.KeyID);
                },
                comment: "卡密")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_Tenant",
                columns: table => new
                {
                    TenantID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Icon = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConnStr = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Province = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProvinceName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    City = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CityName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    County = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CountyName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Code = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_Tenant", x => x.TenantID);
                },
                comment: "")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_User",
                columns: table => new
                {
                    UserID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TenantID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "租户ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeptID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "所属科室")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RoleID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "角色外键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    WxOpenID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "微信openid")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    WxUnionID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "微信unionid")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Balance = table.Column<int>(type: "int", nullable: false, comment: "余额"),
                    LoginName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "登录名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    NickName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "昵称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Avatar = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "头像")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Phone = table.Column<string>(type: "varchar(11)", maxLength: 11, nullable: false, comment: "手机号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RealName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "真实名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Age = table.Column<int>(type: "int", nullable: false, comment: "年龄"),
                    Desc = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Salt = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "盐值")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Pwd = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "密码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "状态"),
                    LastLoginTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "登录时间"),
                    FailedCount = table.Column<int>(type: "int", nullable: false, comment: "登录失败次数"),
                    VipTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "会员时间"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_User", x => x.UserID);
                },
                comment: "系统用户")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Tenant_Area",
                columns: table => new
                {
                    AreaID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "院区主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TenantID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "租户ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Code = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    AddUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AddTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: false, defaultValueSql: "now()", comment: "创建时间"),
                    UpdUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "最后修改时间"),
                    DelUserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "创建人名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DelTime = table.Column<DateTime>(type: "datetime(0)", precision: 0, nullable: true, comment: "软删除时间"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否软删除")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Tenant_Area", x => x.AreaID);
                },
                comment: "院区")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "User_Area",
                columns: table => new
                {
                    UAID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AreaID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_User_Area", x => x.UAID);
                },
                comment: "用户-院区 关系表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "User_Dept",
                columns: table => new
                {
                    UDID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeptID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_User_Dept", x => x.UDID);
                },
                comment: "用户-科室 关系表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "User_Role",
                columns: table => new
                {
                    URID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UserID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RoleID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_User_Role", x => x.URID);
                },
                comment: "用户-角色 关系表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_Sys_SecretKey_Value",
                table: "Sys_SecretKey",
                column: "Value",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Sys_User_LoginName",
                table: "Sys_User",
                column: "LoginName");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "ChargeInfo_Item");

            migrationBuilder.DropTable(
                name: "DiagInfo_Item");

            migrationBuilder.DropTable(
                name: "DiagInfo_OperItem");

            migrationBuilder.DropTable(
                name: "List_BasicInfo");

            migrationBuilder.DropTable(
                name: "List_ChargeInfo");

            migrationBuilder.DropTable(
                name: "List_CheckItem");

            migrationBuilder.DropTable(
                name: "List_DiagInfo");

            migrationBuilder.DropTable(
                name: "List_SepcialDiagInfo");

            migrationBuilder.DropTable(
                name: "Menu_Func");

            migrationBuilder.DropTable(
                name: "Module_Tanent");

            migrationBuilder.DropTable(
                name: "Role_Func");

            migrationBuilder.DropTable(
                name: "Role_Menu");

            migrationBuilder.DropTable(
                name: "Sys_Category");

            migrationBuilder.DropTable(
                name: "Sys_Dept");

            migrationBuilder.DropTable(
                name: "Sys_Enum");

            migrationBuilder.DropTable(
                name: "Sys_Func");

            migrationBuilder.DropTable(
                name: "Sys_List");

            migrationBuilder.DropTable(
                name: "Sys_Menu");

            migrationBuilder.DropTable(
                name: "Sys_Module");

            migrationBuilder.DropTable(
                name: "Sys_Para");

            migrationBuilder.DropTable(
                name: "Sys_PolicyEnum");

            migrationBuilder.DropTable(
                name: "Sys_Record");

            migrationBuilder.DropTable(
                name: "Sys_RefreshToken");

            migrationBuilder.DropTable(
                name: "Sys_Role");

            migrationBuilder.DropTable(
                name: "Sys_SecretKey");

            migrationBuilder.DropTable(
                name: "Sys_Tenant");

            migrationBuilder.DropTable(
                name: "Sys_User");

            migrationBuilder.DropTable(
                name: "Tenant_Area");

            migrationBuilder.DropTable(
                name: "User_Area");

            migrationBuilder.DropTable(
                name: "User_Dept");

            migrationBuilder.DropTable(
                name: "User_Role");
        }
    }
}
